package com.ruoyi.consumer.controller.wallet.walletOperationFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;

@Service
public class DeductionService {

    @Autowired
    private DeductionStrategyFactory strategyFactory;

    public Object takeOrder(Integer facilitId, Integer userId, Long amount, String userType, String snNumber) throws IOException {
        DeductionStrategy strategy = strategyFactory.getStrategy(userType);
        return strategy.takeOrder(userId, facilitId, amount, snNumber);
    }

    public Object getMinOrder(Long orderId, String userType) throws IOException {
        DeductionStrategy strategy = strategyFactory.getStrategy(userType);
        return strategy.getMinOrder(orderId);
    }


}
